/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.Dialogos;

import Logica.EManager;
import java.util.ArrayList;

/**
 *
 * @author jose
 */
public class EdicionBD extends javax.swing.JDialog {

    /**
     * Creates new form EdicionBD
     */
    public EdicionBD(EManager gestor) {
        initComponents();
        this.gestor=gestor;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        comboOpciones = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        comboLugar = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        panelInsertar = new javax.swing.JPanel();
        panelInsertarProvincia = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtNuevaProvincia = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        panelInsertarLocalidad = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtNombreLocalidad = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        comboProvincias = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        txtNumHabitantes = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        panelInsertarCalle = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        txtNombreCalle = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        comboLocalidades = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        txtCP = new javax.swing.JTextField();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        panelModificar = new javax.swing.JPanel();
        panelModificarProvincia = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        comboModificarProvincia = new javax.swing.JComboBox();
        jLabel15 = new javax.swing.JLabel();
        txtNombreProvincia = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        txtIDProvincia = new javax.swing.JTextField();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        panelModificarLocalidad = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        comboModificarLocalidad = new javax.swing.JComboBox();
        jLabel19 = new javax.swing.JLabel();
        txtCodigoModificarLocalidad = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        txtNombreModificarLocalidad = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        txtnumHabitantesModificarLocalidad = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        comboModificarLocalidadprovincia = new javax.swing.JComboBox();
        jButton9 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        panelModificarCalle = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        comboModificarLocalidadCalle = new javax.swing.JComboBox();
        jLabel25 = new javax.swing.JLabel();
        comboModificarCalle = new javax.swing.JComboBox();
        jLabel26 = new javax.swing.JLabel();
        txtModificarCodigoCalle = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        txtModificarNombreCalle = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        txtModificarCP = new javax.swing.JTextField();
        jButton11 = new javax.swing.JButton();
        jButton12 = new javax.swing.JButton();
        jLabel29 = new javax.swing.JLabel();
        comboModificarNuevaLocalidadCalle = new javax.swing.JComboBox();
        panelBorrar = new javax.swing.JPanel();
        panelBorrarProvincia = new javax.swing.JPanel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        comboEliminarProvincia = new javax.swing.JComboBox();
        jButton13 = new javax.swing.JButton();
        btnEliminarProvincia = new javax.swing.JButton();
        chkEliminarMedicionesProvincia = new javax.swing.JCheckBox();
        panelBorrarLocalidad = new javax.swing.JPanel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        comboSeleccionarProvinciaEliminarPoblacion = new javax.swing.JComboBox();
        comboEliminarPoblacion = new javax.swing.JComboBox();
        jLabel36 = new javax.swing.JLabel();
        chkEliminarMedicionesPoblacion = new javax.swing.JCheckBox();
        btnEliminarPoblacion = new javax.swing.JButton();
        jButton14 = new javax.swing.JButton();
        panelBorrarCalle = new javax.swing.JPanel();
        jLabel37 = new javax.swing.JLabel();
        btnEliminarCalle = new javax.swing.JButton();
        chkEliminarMedicionesCalle = new javax.swing.JCheckBox();
        jLabel38 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        comboSeleccionarProvinciaEliminarCalle = new javax.swing.JComboBox();
        jLabel40 = new javax.swing.JLabel();
        comboSeleccionarPoblacionEliminarCalle = new javax.swing.JComboBox();
        jButton15 = new javax.swing.JButton();
        jLabel41 = new javax.swing.JLabel();
        comboEliminarCalle = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText("Opciones:");

        comboOpciones.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Insertar", "Modificar", "Eliminar" }));
        comboOpciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboOpcionesActionPerformed(evt);
            }
        });

        jLabel2.setText("Lugar:");

        comboLugar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Provincia", "Localidad", "Calle" }));
        comboLugar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboLugarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(comboOpciones, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(comboLugar, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(273, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(comboOpciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(comboLugar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);

        jPanel2.setLayout(new java.awt.CardLayout());

        panelInsertar.setLayout(new java.awt.CardLayout());

        jLabel3.setText("Nombre de la nueva provincia:");

        jLabel4.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 0, 0));
        jLabel4.setText("Estas a punto de añadir una nueva provincia a la Base de Datos");

        jButton1.setText("Insertar provincia");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Volver al menú");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelInsertarProvinciaLayout = new javax.swing.GroupLayout(panelInsertarProvincia);
        panelInsertarProvincia.setLayout(panelInsertarProvinciaLayout);
        panelInsertarProvinciaLayout.setHorizontalGroup(
            panelInsertarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInsertarProvinciaLayout.createSequentialGroup()
                .addContainerGap(138, Short.MAX_VALUE)
                .addGroup(panelInsertarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInsertarProvinciaLayout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)
                        .addComponent(txtNuevaProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(89, 89, 89))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInsertarProvinciaLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(63, 63, 63))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInsertarProvinciaLayout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addGap(18, 18, 18)
                        .addComponent(jButton2)
                        .addContainerGap())))
        );
        panelInsertarProvinciaLayout.setVerticalGroup(
            panelInsertarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInsertarProvinciaLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelInsertarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtNuevaProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
                .addGroup(panelInsertarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2))
                .addContainerGap())
        );

        panelInsertar.add(panelInsertarProvincia, "card2");

        jLabel5.setText("Nombre:");

        jLabel6.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(255, 0, 0));
        jLabel6.setText("Estas a punto de añadir una nueva localidad a la Base de Datos");

        jLabel7.setText("Provincia:");

        comboProvincias.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));

        jLabel8.setText("Habitantes:");

        jButton3.setText("Volver al menú");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Insertar localidad");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelInsertarLocalidadLayout = new javax.swing.GroupLayout(panelInsertarLocalidad);
        panelInsertarLocalidad.setLayout(panelInsertarLocalidadLayout);
        panelInsertarLocalidadLayout.setHorizontalGroup(
            panelInsertarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInsertarLocalidadLayout.createSequentialGroup()
                .addGroup(panelInsertarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInsertarLocalidadLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNombreLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboProvincias, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNumHabitantes))
                    .addGroup(panelInsertarLocalidadLayout.createSequentialGroup()
                        .addGap(85, 85, 85)
                        .addComponent(jLabel6)
                        .addGap(0, 103, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInsertarLocalidadLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton4)
                        .addGap(18, 18, 18)
                        .addComponent(jButton3)))
                .addContainerGap())
        );
        panelInsertarLocalidadLayout.setVerticalGroup(
            panelInsertarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInsertarLocalidadLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelInsertarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtNombreLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(comboProvincias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(txtNumHabitantes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
                .addGroup(panelInsertarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton3)
                    .addComponent(jButton4))
                .addContainerGap())
        );

        panelInsertar.add(panelInsertarLocalidad, "card3");

        jLabel9.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(255, 0, 0));
        jLabel9.setText("Estas a punto de añadir una nueva calle a la Base de Datos");

        jLabel10.setText("Nombre:");

        jLabel11.setText("Localidad:");

        comboLocalidades.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));

        jLabel12.setText("C.P.");

        jButton5.setText("Volver al menú");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setText("Insertar calle");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelInsertarCalleLayout = new javax.swing.GroupLayout(panelInsertarCalle);
        panelInsertarCalle.setLayout(panelInsertarCalleLayout);
        panelInsertarCalleLayout.setHorizontalGroup(
            panelInsertarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInsertarCalleLayout.createSequentialGroup()
                .addGroup(panelInsertarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelInsertarCalleLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton6)
                        .addGap(18, 18, 18)
                        .addComponent(jButton5))
                    .addGroup(panelInsertarCalleLayout.createSequentialGroup()
                        .addGap(106, 106, 106)
                        .addComponent(jLabel9)
                        .addGap(0, 120, Short.MAX_VALUE))
                    .addGroup(panelInsertarCalleLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNombreCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboLocalidades, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtCP)))
                .addContainerGap())
        );
        panelInsertarCalleLayout.setVerticalGroup(
            panelInsertarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInsertarCalleLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jLabel9)
                .addGap(18, 18, 18)
                .addGroup(panelInsertarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNombreCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(jLabel11)
                    .addComponent(comboLocalidades, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(txtCP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 69, Short.MAX_VALUE)
                .addGroup(panelInsertarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton5)
                    .addComponent(jButton6))
                .addContainerGap())
        );

        panelInsertar.add(panelInsertarCalle, "card4");

        jPanel2.add(panelInsertar, "card2");

        panelModificar.setLayout(new java.awt.CardLayout());

        panelModificarProvincia.setBackground(new java.awt.Color(254, 254, 254));

        jLabel13.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel13.setForeground(new java.awt.Color(255, 0, 0));
        jLabel13.setText("Estas a punto de modificar una provincia en la Base de Datos");

        jLabel14.setText("Provincia:");

        comboModificarProvincia.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
        comboModificarProvincia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboModificarProvinciaActionPerformed(evt);
            }
        });

        jLabel15.setText("Nombre:");

        jLabel16.setText("Identificador:");

        jButton7.setText("Volver a menú");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jButton8.setText("Modificar provincia");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelModificarProvinciaLayout = new javax.swing.GroupLayout(panelModificarProvincia);
        panelModificarProvincia.setLayout(panelModificarProvinciaLayout);
        panelModificarProvinciaLayout.setHorizontalGroup(
            panelModificarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelModificarProvinciaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelModificarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelModificarProvinciaLayout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboModificarProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNombreProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtIDProvincia)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarProvinciaLayout.createSequentialGroup()
                        .addGap(0, 120, Short.MAX_VALUE)
                        .addGroup(panelModificarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarProvinciaLayout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addGap(87, 87, 87))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarProvinciaLayout.createSequentialGroup()
                                .addComponent(jButton8)
                                .addGap(18, 18, 18)
                                .addComponent(jButton7)
                                .addContainerGap())))))
        );
        panelModificarProvinciaLayout.setVerticalGroup(
            panelModificarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelModificarProvinciaLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel13)
                .addGap(18, 18, 18)
                .addGroup(panelModificarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(comboModificarProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15)
                    .addComponent(txtNombreProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16)
                    .addComponent(txtIDProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
                .addGroup(panelModificarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton7)
                    .addComponent(jButton8))
                .addContainerGap())
        );

        panelModificar.add(panelModificarProvincia, "card2");

        panelModificarLocalidad.setBackground(new java.awt.Color(254, 254, 254));

        jLabel17.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel17.setForeground(new java.awt.Color(255, 0, 0));
        jLabel17.setText("Estas a punto de modificar una localidad en la Base de Datos");

        jLabel18.setText("Localidad:");

        comboModificarLocalidad.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
        comboModificarLocalidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboModificarLocalidadActionPerformed(evt);
            }
        });

        jLabel19.setText("Codigo:");

        jLabel20.setText("Nombre:");

        jLabel21.setText("Habitantes:");

        jLabel22.setText("Provincia:");

        comboModificarLocalidadprovincia.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""}));

        jButton9.setText("Volver a menú");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jButton10.setText("Modificar localidad");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelModificarLocalidadLayout = new javax.swing.GroupLayout(panelModificarLocalidad);
        panelModificarLocalidad.setLayout(panelModificarLocalidadLayout);
        panelModificarLocalidadLayout.setHorizontalGroup(
            panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelModificarLocalidadLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarLocalidadLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel17)
                        .addGap(88, 88, 88))
                    .addGroup(panelModificarLocalidadLayout.createSequentialGroup()
                        .addGroup(panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel18)
                            .addComponent(jLabel19))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(panelModificarLocalidadLayout.createSequentialGroup()
                                .addComponent(comboModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(217, 217, 217))
                            .addGroup(panelModificarLocalidadLayout.createSequentialGroup()
                                .addComponent(txtCodigoModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(36, 36, 36)
                                .addComponent(jLabel20)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtNombreModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
                        .addGroup(panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(panelModificarLocalidadLayout.createSequentialGroup()
                                .addComponent(jLabel21)
                                .addGap(18, 18, 18)
                                .addComponent(txtnumHabitantesModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(panelModificarLocalidadLayout.createSequentialGroup()
                                .addComponent(jLabel22)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(comboModificarLocalidadprovincia, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addContainerGap())))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarLocalidadLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton10)
                .addGap(18, 18, 18)
                .addComponent(jButton9)
                .addContainerGap())
        );
        panelModificarLocalidadLayout.setVerticalGroup(
            panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelModificarLocalidadLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel17)
                .addGap(18, 18, 18)
                .addGroup(panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(comboModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22)
                    .addComponent(comboModificarLocalidadprovincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(jLabel19)
                    .addComponent(txtCodigoModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNombreModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21)
                    .addComponent(txtnumHabitantesModificarLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                .addGroup(panelModificarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton9)
                    .addComponent(jButton10))
                .addContainerGap())
        );

        panelModificar.add(panelModificarLocalidad, "card3");

        panelModificarCalle.setBackground(new java.awt.Color(254, 254, 254));

        jLabel23.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel23.setForeground(new java.awt.Color(255, 0, 0));
        jLabel23.setText("Estas a punto de modificar una calle en la Base de Datos");

        jLabel24.setText("Localidad:");

        comboModificarLocalidadCalle.setModel(new javax.swing.DefaultComboBoxModel(new String[]{""}));
        comboModificarLocalidadCalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboModificarLocalidadCalleActionPerformed(evt);
            }
        });

        jLabel25.setText("Calle:");

        comboModificarCalle.setModel(new javax.swing.DefaultComboBoxModel(new String[]{""}));
        comboModificarCalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboModificarCalleActionPerformed(evt);
            }
        });

        jLabel26.setText("Codigo:");

        jLabel27.setText("Nombre:");

        jLabel28.setText("CP:");

        jButton11.setText("Volver a menú");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jButton12.setText("Modificar calle");
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        jLabel29.setText("N. Loc:");

        comboModificarNuevaLocalidadCalle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));

        javax.swing.GroupLayout panelModificarCalleLayout = new javax.swing.GroupLayout(panelModificarCalle);
        panelModificarCalle.setLayout(panelModificarCalleLayout);
        panelModificarCalleLayout.setHorizontalGroup(
            panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelModificarCalleLayout.createSequentialGroup()
                .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelModificarCalleLayout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboModificarLocalidadCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboModificarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(panelModificarCalleLayout.createSequentialGroup()
                        .addGap(0, 29, Short.MAX_VALUE)
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtModificarCodigoCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtModificarNombreCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel28, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel29, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(comboModificarNuevaLocalidadCalle, 0, 135, Short.MAX_VALUE)
                    .addComponent(txtModificarCP))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarCalleLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarCalleLayout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addGap(103, 103, 103))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelModificarCalleLayout.createSequentialGroup()
                        .addComponent(jButton12)
                        .addGap(18, 18, 18)
                        .addComponent(jButton11)
                        .addContainerGap())))
        );
        panelModificarCalleLayout.setVerticalGroup(
            panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelModificarCalleLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jLabel23)
                .addGap(18, 18, 18)
                .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(comboModificarLocalidadCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25)
                    .addComponent(comboModificarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel29)
                    .addComponent(comboModificarNuevaLocalidadCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel27)
                    .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel26)
                        .addComponent(txtModificarNombreCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel28)
                        .addComponent(txtModificarCP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtModificarCodigoCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addGroup(panelModificarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton11)
                    .addComponent(jButton12))
                .addContainerGap())
        );

        panelModificar.add(panelModificarCalle, "card4");

        jPanel2.add(panelModificar, "card3");

        panelBorrar.setLayout(new java.awt.CardLayout());

        panelBorrarProvincia.setBackground(new java.awt.Color(254, 254, 254));

        jLabel30.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel30.setForeground(new java.awt.Color(255, 0, 0));
        jLabel30.setText("Estas a punto de eliminar una provincia en la Base de Datos");

        jLabel31.setFont(new java.awt.Font("Cantarell", 2, 14)); // NOI18N
        jLabel31.setText("Se borrarán las poblaciones, calles y clientes asociados");

        jLabel32.setText("Selecciona la provincia:");

        comboEliminarProvincia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));

        jButton13.setText("Volver a menú");
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });

        btnEliminarProvincia.setText("Eliminar provincia");
        btnEliminarProvincia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarProvinciaActionPerformed(evt);
            }
        });

        chkEliminarMedicionesProvincia.setFont(new java.awt.Font("Cantarell", 2, 14)); // NOI18N
        chkEliminarMedicionesProvincia.setText("Tambien eliminar mediciones realizadas en dicha provincia");
        chkEliminarMedicionesProvincia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkEliminarMedicionesProvinciaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBorrarProvinciaLayout = new javax.swing.GroupLayout(panelBorrarProvincia);
        panelBorrarProvincia.setLayout(panelBorrarProvinciaLayout);
        panelBorrarProvinciaLayout.setHorizontalGroup(
            panelBorrarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarProvinciaLayout.createSequentialGroup()
                .addGap(0, 144, Short.MAX_VALUE)
                .addGroup(panelBorrarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarProvinciaLayout.createSequentialGroup()
                        .addComponent(jLabel30)
                        .addGap(88, 88, 88))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarProvinciaLayout.createSequentialGroup()
                        .addComponent(btnEliminarProvincia)
                        .addGap(18, 18, 18)
                        .addComponent(jButton13)
                        .addContainerGap())))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarProvinciaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(panelBorrarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(chkEliminarMedicionesProvincia)
                    .addGroup(panelBorrarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panelBorrarProvinciaLayout.createSequentialGroup()
                            .addGap(15, 15, 15)
                            .addComponent(jLabel31))
                        .addGroup(panelBorrarProvinciaLayout.createSequentialGroup()
                            .addComponent(jLabel32)
                            .addGap(31, 31, 31)
                            .addComponent(comboEliminarProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(176, 176, 176))
        );
        panelBorrarProvinciaLayout.setVerticalGroup(
            panelBorrarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBorrarProvinciaLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jLabel30)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelBorrarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboEliminarProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel32))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkEliminarMedicionesProvincia)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                .addGroup(panelBorrarProvinciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton13)
                    .addComponent(btnEliminarProvincia))
                .addContainerGap())
        );

        panelBorrar.add(panelBorrarProvincia, "card2");

        panelBorrarLocalidad.setBackground(new java.awt.Color(254, 254, 254));

        jLabel33.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel33.setForeground(new java.awt.Color(255, 0, 0));
        jLabel33.setText("Estas a punto de eliminar una poblacion en la Base de Datos");

        jLabel34.setFont(new java.awt.Font("Cantarell", 2, 14)); // NOI18N
        jLabel34.setText("Se borrarán las calles y clientes asociados");

        jLabel35.setText("Selecciona la provincia:");

        comboSeleccionarProvinciaEliminarPoblacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        comboSeleccionarProvinciaEliminarPoblacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboSeleccionarProvinciaEliminarPoblacionActionPerformed(evt);
            }
        });

        comboEliminarPoblacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        comboEliminarPoblacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboEliminarPoblacionActionPerformed(evt);
            }
        });

        jLabel36.setText("Selecciona la población:");

        chkEliminarMedicionesPoblacion.setFont(new java.awt.Font("Cantarell", 2, 14)); // NOI18N
        chkEliminarMedicionesPoblacion.setText("Tambien eliminar mediciones realizadas en dicha población");
        chkEliminarMedicionesPoblacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkEliminarMedicionesPoblacionActionPerformed(evt);
            }
        });

        btnEliminarPoblacion.setText("Eliminar población");
        btnEliminarPoblacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarPoblacionActionPerformed(evt);
            }
        });

        jButton14.setText("Volver a menú");
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBorrarLocalidadLayout = new javax.swing.GroupLayout(panelBorrarLocalidad);
        panelBorrarLocalidad.setLayout(panelBorrarLocalidadLayout);
        panelBorrarLocalidadLayout.setHorizontalGroup(
            panelBorrarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBorrarLocalidadLayout.createSequentialGroup()
                .addGroup(panelBorrarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelBorrarLocalidadLayout.createSequentialGroup()
                        .addGap(200, 200, 200)
                        .addComponent(jLabel34)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(panelBorrarLocalidadLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel35)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboSeleccionarProvinciaEliminarPoblacion, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 70, Short.MAX_VALUE)
                        .addComponent(jLabel36)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboEliminarPoblacion, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarLocalidadLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(panelBorrarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarLocalidadLayout.createSequentialGroup()
                        .addComponent(jLabel33)
                        .addGap(95, 95, 95))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarLocalidadLayout.createSequentialGroup()
                        .addComponent(btnEliminarPoblacion)
                        .addGap(18, 18, 18)
                        .addComponent(jButton14)
                        .addContainerGap())))
            .addGroup(panelBorrarLocalidadLayout.createSequentialGroup()
                .addGap(162, 162, 162)
                .addComponent(chkEliminarMedicionesPoblacion)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        panelBorrarLocalidadLayout.setVerticalGroup(
            panelBorrarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBorrarLocalidadLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel33)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel34, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(panelBorrarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboSeleccionarProvinciaEliminarPoblacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel35)
                    .addComponent(comboEliminarPoblacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel36))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkEliminarMedicionesPoblacion)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addGroup(panelBorrarLocalidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton14)
                    .addComponent(btnEliminarPoblacion))
                .addContainerGap())
        );

        panelBorrar.add(panelBorrarLocalidad, "card3");

        panelBorrarCalle.setBackground(new java.awt.Color(254, 254, 254));

        jLabel37.setText("Población:");

        btnEliminarCalle.setText("Eliminar calle");
        btnEliminarCalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarCalleActionPerformed(evt);
            }
        });

        chkEliminarMedicionesCalle.setFont(new java.awt.Font("Cantarell", 2, 14)); // NOI18N
        chkEliminarMedicionesCalle.setText("Tambien eliminar mediciones realizadas en dicha calle");
        chkEliminarMedicionesCalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkEliminarMedicionesCalleActionPerformed(evt);
            }
        });

        jLabel38.setText("Provincia:");

        jLabel39.setFont(new java.awt.Font("Cantarell", 3, 18)); // NOI18N
        jLabel39.setForeground(new java.awt.Color(255, 0, 0));
        jLabel39.setText("Estas a punto de eliminar una calle en la Base de Datos");

        comboSeleccionarProvinciaEliminarCalle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        comboSeleccionarProvinciaEliminarCalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboSeleccionarProvinciaEliminarCalleActionPerformed(evt);
            }
        });

        jLabel40.setFont(new java.awt.Font("Cantarell", 2, 14)); // NOI18N
        jLabel40.setText("Se borrarán los clientes asociados");

        comboSeleccionarPoblacionEliminarCalle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        comboSeleccionarPoblacionEliminarCalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboSeleccionarPoblacionEliminarCalleActionPerformed(evt);
            }
        });

        jButton15.setText("Volver a menú");
        jButton15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton15ActionPerformed(evt);
            }
        });

        jLabel41.setText("Calle:");

        comboEliminarCalle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        comboEliminarCalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboEliminarCalleActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBorrarCalleLayout = new javax.swing.GroupLayout(panelBorrarCalle);
        panelBorrarCalle.setLayout(panelBorrarCalleLayout);
        panelBorrarCalleLayout.setHorizontalGroup(
            panelBorrarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBorrarCalleLayout.createSequentialGroup()
                .addGroup(panelBorrarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelBorrarCalleLayout.createSequentialGroup()
                        .addGap(200, 200, 200)
                        .addComponent(jLabel40)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(panelBorrarCalleLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel38)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboSeleccionarProvinciaEliminarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel37)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboSeleccionarPoblacionEliminarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
                        .addComponent(jLabel41)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboEliminarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(panelBorrarCalleLayout.createSequentialGroup()
                .addGap(162, 162, 162)
                .addComponent(chkEliminarMedicionesCalle)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarCalleLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(panelBorrarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarCalleLayout.createSequentialGroup()
                        .addComponent(btnEliminarCalle)
                        .addGap(18, 18, 18)
                        .addComponent(jButton15)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBorrarCalleLayout.createSequentialGroup()
                        .addComponent(jLabel39)
                        .addGap(122, 122, 122))))
        );
        panelBorrarCalleLayout.setVerticalGroup(
            panelBorrarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBorrarCalleLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel39)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(panelBorrarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboSeleccionarProvinciaEliminarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel38)
                    .addComponent(comboSeleccionarPoblacionEliminarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel37)
                    .addComponent(jLabel41)
                    .addComponent(comboEliminarCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkEliminarMedicionesCalle)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addGroup(panelBorrarCalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton15)
                    .addComponent(btnEliminarCalle))
                .addContainerGap())
        );

        panelBorrar.add(panelBorrarCalle, "card4");

        jPanel2.add(panelBorrar, "card4");

        getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        boolean insertado=false;
        if (!txtNuevaProvincia.getText().equals(""))
        {
            insertado=gestor.AddProvincia(txtNuevaProvincia.getText());
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
        if (insertado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        boolean insertado=false;
        if ((!txtNombreLocalidad.getText().equals(""))&&(!txtNumHabitantes.getText().equals("")))
        {
            String codProvincia=gestor.getCodigoProvincia(comboProvincias.getSelectedItem().toString()); 
            insertado=gestor.AddPoblacion(txtNombreLocalidad.getText(),codProvincia,txtNumHabitantes.getText());
        }else{
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
         if (insertado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
        
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        boolean insertado=false;
        if ((!txtNombreCalle.getText().equals(""))&&(!txtCP.getText().equals("")))
        {
            String codLocalidad=gestor.getCodigoLocalidad(comboLocalidades.getSelectedItem().toString()); 
            insertado=gestor.AddCalle(txtNombreCalle.getText(),codLocalidad,txtCP.getText());
        }else{
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
         if (insertado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_jButton6ActionPerformed

    private void comboLugarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboLugarActionPerformed

        switch(comboOpciones.getSelectedIndex())
        {
            case 0://Si se ha seleccionado Insertar
            panelInsertar.setVisible(true);
            panelBorrar.setVisible(false);
            panelModificar.setVisible(false);
            switch(comboLugar.getSelectedIndex())
            {
                case 0://Si se ha seleccionado provincia
                panelInsertarCalle.setVisible(false);
                panelInsertarLocalidad.setVisible(false);
                panelInsertarProvincia.setVisible(true);
                break;

                case 1://Si se ha seleccionado localidad
                panelInsertarCalle.setVisible(false);
                panelInsertarProvincia.setVisible(false);
                panelInsertarLocalidad.setVisible(true);
                arrayLugar=gestor.ListarNombresProvincias();
                for(int i=0;i<arrayLugar.length;i++)
                {
                    comboProvincias.addItem(arrayLugar[i]);
                }
                break;

                case 2://Si se ha seleccionado calle
                panelInsertarProvincia.setVisible(false);
                panelInsertarLocalidad.setVisible(false);
                panelInsertarCalle.setVisible(true);
                arrayLugar=gestor.ListarNombresLocalidades();
                for(int i=0;i<arrayLugar.length;i++)
                {
                    comboLocalidades.addItem(arrayLugar[i]);
                }
                break;
            }
            break;
            case 1://Si se ha seleccionado modificar
                panelInsertar.setVisible(false);
                panelBorrar.setVisible(false);
                panelModificar.setVisible(true);
                switch(comboLugar.getSelectedIndex())
                {
                    case 0://Si se ha seleccionado provincia
                    panelModificarLocalidad.setVisible(false);
                    panelModificarCalle.setVisible(false);
                    panelModificarProvincia.setVisible(true);
                    arrayLugar=gestor.ListarNombresProvincias();
                    comboModificarProvincia.removeAllItems();
                    panelModificarProvincia.setVisible(true);
                    for(int i=0;i<arrayLugar.length;i++)
                    {
                    comboModificarProvincia.addItem(arrayLugar[i]);
                    }
                    break;
                    case 1://Si se ha seleccionado localidad
                        panelModificarLocalidad.setVisible(true);
                          panelModificarProvincia.setVisible(false);
                         panelModificarCalle.setVisible(false);
                         arrayLugar=gestor.ListarNombresLocalidades();
                        comboModificarLocalidad.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
                        break;
                    case 2://Si se ha seleccionado calle
                        panelModificarLocalidad.setVisible(false);
                        panelModificarProvincia.setVisible(false);
                        panelModificarCalle.setVisible(true);
                        arrayLugar=gestor.ListarNombresLocalidades();
                        comboModificarLocalidadCalle.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
                        arrayLugar=gestor.ListarNombresLocalidades();
                        comboModificarNuevaLocalidadCalle.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
                        break;
                }
                break;
           case 2://Si se ha seleccionado eliminar
                panelInsertar.setVisible(false);
                panelModificar.setVisible(false);
                panelBorrar.setVisible(true);
                switch(comboLugar.getSelectedIndex())
                {
                    case 0://Si se ha seleccionado provincia
                    panelBorrarLocalidad.setVisible(false);
                    panelBorrarCalle.setVisible(false);
                    panelBorrarProvincia.setVisible(true);
                    arrayLugar=gestor.ListarNombresProvincias();
                    comboEliminarProvincia.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
                    break;
                    case 1://Si se ha seleccionado localidad
                        panelBorrarLocalidad.setVisible(true);
                          panelBorrarProvincia.setVisible(false);
                         panelBorrarCalle.setVisible(false);
                         arrayLugar=gestor.ListarNombresProvincias();
                        comboSeleccionarProvinciaEliminarPoblacion.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
                        break;
                    case 2://Si se ha seleccionado calle
                        panelBorrarLocalidad.setVisible(false);
                        panelBorrarProvincia.setVisible(false);
                        panelBorrarCalle.setVisible(true);
                        arrayLugar=gestor.ListarNombresProvincias();
                        comboSeleccionarProvinciaEliminarCalle.setModel(new javax.swing.DefaultComboBoxModel(arrayLugar));
                        break;
                        
        }

        /*        comboLugarASeleccionar.removeAllItems();
        switch(comboLugar.getSelectedIndex())
        {
            case 0://Si se ha seleccionado provincia
            arrayLugar=gestor.ListarNombresProvincias();
            for(int i=0;i<arrayLugar.length;i++)
            {
                comboLugarASeleccionar.addItem(arrayLugar[i]);
            }
            break;
            case 1://Si se ha seleccionado localidad
            arrayLugar=gestor.ListarNombresLocalidades();
            for(int i=0;i<arrayLugar.length;i++)
            {
                comboLugarASeleccionar.addItem(arrayLugar[i]);
            }
            break;
            case 2:

        }
    }//GEN-LAST:event_comboLugarActionPerformed
*/}}
    private void comboModificarProvinciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModificarProvinciaActionPerformed
        String prov=comboModificarProvincia.getSelectedItem().toString();
        txtNombreProvincia.setText(prov);
        txtIDProvincia.setText(gestor.getCodigoProvincia(prov));
    }//GEN-LAST:event_comboModificarProvinciaActionPerformed

    private void comboOpcionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboOpcionesActionPerformed
        comboLugarActionPerformed(evt);
    }//GEN-LAST:event_comboOpcionesActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        boolean modificado=false;
        if ((!txtIDProvincia.getText().equals(""))&&(!txtNombreProvincia.getText().equals("")))
        {
            String codProv=gestor.getCodigoProvincia(comboModificarProvincia.getSelectedItem().toString()); 
            modificado=gestor.ModificarProvincia(codProv,txtIDProvincia.getText(),txtNombreProvincia.getText());
        }else{
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
         if (modificado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_jButton8ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        boolean modificado=false;
        if ((!txtCodigoModificarLocalidad.getText().equals(""))&&(!txtNombreModificarLocalidad.getText().equals(""))
        &&(!txtnumHabitantesModificarLocalidad.getText().equals("")))
        {
            String codLoc=gestor.getCodigoLocalidad(comboModificarLocalidad.getSelectedItem().toString()); 
            String codProvdelaLocalidad=gestor.getCodigoProvincia(comboModificarLocalidadprovincia.getSelectedItem().toString());
            modificado=gestor.ModificarPoblacion(codLoc,codProvdelaLocalidad,txtCodigoModificarLocalidad.getText(),
                       txtNombreModificarLocalidad.getText(),txtnumHabitantesModificarLocalidad.getText());
        }else{
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
         if (modificado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_jButton10ActionPerformed

    private void comboModificarLocalidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModificarLocalidadActionPerformed
        comboModificarLocalidadprovincia.setModel(new javax.swing.DefaultComboBoxModel(gestor.ListarNombresProvincias()));
        String localidad=String.valueOf(comboModificarLocalidad.getSelectedItem());
        txtCodigoModificarLocalidad.setText(gestor.getCodigoLocalidad(localidad));
        txtNombreModificarLocalidad.setText(localidad);
        //txtnumHabitantesModificarLocalidad.setText(blablaaaaaaaaaaa);
    }//GEN-LAST:event_comboModificarLocalidadActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton11ActionPerformed

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
         boolean modificado=false;
        if ((!txtModificarCP.getText().equals(""))&&(!txtModificarCodigoCalle.getText().equals(""))
        &&(!txtModificarNombreCalle.getText().equals("")))
        {
            String calle=comboModificarLocalidadCalle.getSelectedItem().toString();
        String localidad=comboModificarLocalidadCalle.getSelectedItem().toString();
        String nuevaLocalidad=comboModificarNuevaLocalidadCalle.getSelectedItem().toString();
        String codLocalidad=gestor.getCodigoLocalidad(localidad);
        String codNuevaLocalidad=gestor.getCodigoLocalidad(nuevaLocalidad);
        String codCalle=gestor.getCodigoCalle(codLocalidad,calle);
            modificado=gestor.ModificarCalle(codCalle,codNuevaLocalidad,txtModificarCodigoCalle.getText(),
                       txtModificarNombreCalle.getText(),txtModificarCP.getText());
        }else{
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
         if (modificado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_jButton12ActionPerformed

    private void comboModificarLocalidadCalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModificarLocalidadCalleActionPerformed
        ArrayList<String> listaCalles=new ArrayList<String>();
        listaCalles=gestor.getCalles(comboModificarLocalidadCalle.getSelectedItem().toString());
        String[] arrayCalles = listaCalles.toArray(new String[listaCalles.size()]);
        comboModificarCalle.setModel(new javax.swing.DefaultComboBoxModel(arrayCalles));
    }//GEN-LAST:event_comboModificarLocalidadCalleActionPerformed

    private void comboModificarCalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModificarCalleActionPerformed
        String calle=comboModificarCalle.getSelectedItem().toString();
        String localidad=comboModificarLocalidadCalle.getSelectedItem().toString();
        String codLocalidad=gestor.getCodigoLocalidad(localidad);
        String codCalle=gestor.getCodigoCalle(codLocalidad,calle);
        txtModificarNombreCalle.setText(calle);
        txtModificarCodigoCalle.setText(codCalle);
        //txtModificarCP.settext(eeeeeeeeeeeeeee);
    }//GEN-LAST:event_comboModificarCalleActionPerformed

    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton13ActionPerformed

    private void btnEliminarProvinciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarProvinciaActionPerformed
        boolean borrarMediciones=chkEliminarMedicionesProvincia.isSelected();
        String provinciaSeleccionada=comboEliminarProvincia.getSelectedItem().toString();
        System.out.println("Provincia"+provinciaSeleccionada);
        boolean modificado=false;
        modificado=gestor.EliminarProvincia(provinciaSeleccionada,borrarMediciones);
         if (modificado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_btnEliminarProvinciaActionPerformed

    private void chkEliminarMedicionesProvinciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkEliminarMedicionesProvinciaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_chkEliminarMedicionesProvinciaActionPerformed

    private void comboEliminarPoblacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboEliminarPoblacionActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_comboEliminarPoblacionActionPerformed

    private void chkEliminarMedicionesPoblacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkEliminarMedicionesPoblacionActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_chkEliminarMedicionesPoblacionActionPerformed

    private void btnEliminarPoblacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarPoblacionActionPerformed
        boolean borrarMediciones=chkEliminarMedicionesPoblacion.isSelected();
        String poblacionSeleccionada=comboEliminarPoblacion.getSelectedItem().toString();
        boolean modificado=false;
        modificado=gestor.EliminarPoblacion(poblacionSeleccionada,borrarMediciones);
         if (modificado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_btnEliminarPoblacionActionPerformed

    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton14ActionPerformed

    private void comboSeleccionarProvinciaEliminarPoblacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSeleccionarProvinciaEliminarPoblacionActionPerformed
        ArrayList<String> listaPoblaciones=new ArrayList<String>();
        listaPoblaciones=gestor.getLocalidades(comboSeleccionarProvinciaEliminarPoblacion.getSelectedItem().toString());
        String[] arrayPoblaciones = listaPoblaciones.toArray(new String[listaPoblaciones.size()]);
        comboEliminarPoblacion.setModel(new javax.swing.DefaultComboBoxModel(arrayPoblaciones));
    }//GEN-LAST:event_comboSeleccionarProvinciaEliminarPoblacionActionPerformed

    private void btnEliminarCalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarCalleActionPerformed
        boolean borrarMediciones=chkEliminarMedicionesCalle.isSelected();
        String calleSeleccionada=comboEliminarCalle.getSelectedItem().toString();
        String localidadSeleccionada=comboSeleccionarPoblacionEliminarCalle.getSelectedItem().toString();
        String codLocalidad=gestor.getCodigoLocalidad(localidadSeleccionada);
        boolean modificado=false;
        modificado=gestor.EliminarCalle(codLocalidad,calleSeleccionada,borrarMediciones);
         if (modificado==true)
        {
            Correcto correcto=new Correcto();
            correcto.setVisible(true);
        }
        else
        {
            Fallo fallo=new Fallo();
            fallo.setVisible(true);
        }
    }//GEN-LAST:event_btnEliminarCalleActionPerformed

    private void chkEliminarMedicionesCalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkEliminarMedicionesCalleActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_chkEliminarMedicionesCalleActionPerformed

    private void comboSeleccionarProvinciaEliminarCalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSeleccionarProvinciaEliminarCalleActionPerformed
        ArrayList<String> listaPoblaciones=new ArrayList<String>();
        listaPoblaciones=gestor.getLocalidades(comboSeleccionarProvinciaEliminarCalle.getSelectedItem().toString());
        String[] arrayPoblaciones = listaPoblaciones.toArray(new String[listaPoblaciones.size()]);
        comboSeleccionarPoblacionEliminarCalle.setModel(new javax.swing.DefaultComboBoxModel(arrayPoblaciones));
    }//GEN-LAST:event_comboSeleccionarProvinciaEliminarCalleActionPerformed

    private void comboSeleccionarPoblacionEliminarCalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSeleccionarPoblacionEliminarCalleActionPerformed
        ArrayList<String> listaCalles=new ArrayList<String>();
        listaCalles=gestor.getCalles(comboSeleccionarPoblacionEliminarCalle.getSelectedItem().toString());
        String[] arrayCalles = listaCalles.toArray(new String[listaCalles.size()]);
        comboEliminarCalle.setModel(new javax.swing.DefaultComboBoxModel(arrayCalles));
    }//GEN-LAST:event_comboSeleccionarPoblacionEliminarCalleActionPerformed

    private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
        setVisible(false);
    }//GEN-LAST:event_jButton15ActionPerformed

    private void comboEliminarCalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboEliminarCalleActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_comboEliminarCalleActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnEliminarCalle;
    private javax.swing.JButton btnEliminarPoblacion;
    private javax.swing.JButton btnEliminarProvincia;
    private javax.swing.JCheckBox chkEliminarMedicionesCalle;
    private javax.swing.JCheckBox chkEliminarMedicionesPoblacion;
    private javax.swing.JCheckBox chkEliminarMedicionesProvincia;
    private javax.swing.JComboBox comboEliminarCalle;
    private javax.swing.JComboBox comboEliminarPoblacion;
    private javax.swing.JComboBox comboEliminarProvincia;
    private javax.swing.JComboBox comboLocalidades;
    private javax.swing.JComboBox comboLugar;
    private javax.swing.JComboBox comboModificarCalle;
    private javax.swing.JComboBox comboModificarLocalidad;
    private javax.swing.JComboBox comboModificarLocalidadCalle;
    private javax.swing.JComboBox comboModificarLocalidadprovincia;
    private javax.swing.JComboBox comboModificarNuevaLocalidadCalle;
    private javax.swing.JComboBox comboModificarProvincia;
    private javax.swing.JComboBox comboOpciones;
    private javax.swing.JComboBox comboProvincias;
    private javax.swing.JComboBox comboSeleccionarPoblacionEliminarCalle;
    private javax.swing.JComboBox comboSeleccionarProvinciaEliminarCalle;
    private javax.swing.JComboBox comboSeleccionarProvinciaEliminarPoblacion;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel panelBorrar;
    private javax.swing.JPanel panelBorrarCalle;
    private javax.swing.JPanel panelBorrarLocalidad;
    private javax.swing.JPanel panelBorrarProvincia;
    private javax.swing.JPanel panelInsertar;
    private javax.swing.JPanel panelInsertarCalle;
    private javax.swing.JPanel panelInsertarLocalidad;
    private javax.swing.JPanel panelInsertarProvincia;
    private javax.swing.JPanel panelModificar;
    private javax.swing.JPanel panelModificarCalle;
    private javax.swing.JPanel panelModificarLocalidad;
    private javax.swing.JPanel panelModificarProvincia;
    private javax.swing.JTextField txtCP;
    private javax.swing.JTextField txtCodigoModificarLocalidad;
    private javax.swing.JTextField txtIDProvincia;
    private javax.swing.JTextField txtModificarCP;
    private javax.swing.JTextField txtModificarCodigoCalle;
    private javax.swing.JTextField txtModificarNombreCalle;
    private javax.swing.JTextField txtNombreCalle;
    private javax.swing.JTextField txtNombreLocalidad;
    private javax.swing.JTextField txtNombreModificarLocalidad;
    private javax.swing.JTextField txtNombreProvincia;
    private javax.swing.JTextField txtNuevaProvincia;
    private javax.swing.JTextField txtNumHabitantes;
    private javax.swing.JTextField txtnumHabitantesModificarLocalidad;
    // End of variables declaration//GEN-END:variables
    private String[] arrayLugar=new String[0];
    private EManager gestor;
}
